// SPDX-License-Identifier: GPL-2.0-or-later
// Copyright (c) 2023 Yevhen Babiichuk (DustDFG)

#ifndef _VECTOR_TUBE_SET_BUILDER_HPP_
#define _VECTOR_TUBE_SET_BUILDER_HPP_

#include <vector>
#include <cstdint>

#include <Abracadabra/TubeSetBuilder.hpp>

class VectorTubeSetBuilder : public TubeSetBuilder
{
	private:
		int8_t tubeSize;
		uint8_t tubeCount;
		std::vector<std::vector<uint8_t>> ldots;

	public:
		VectorTubeSetBuilder(int8_t tubeSize, uint8_t tubeCount, std::vector<std::vector<uint8_t>> ldots)
			: tubeSize(tubeSize)
			, tubeCount(tubeCount)
			, ldots(ldots)
		{
		}

		virtual TubeSet* operator()()
		{
			TubeSet* tubeSet = new TubeSet(tubeSize, tubeCount);

			for(uint8_t i = 0; i < this->ldots.size(); ++i)
			{
				auto tube = ldots[i];
				for(auto dot : tube)
				{
					this->push(tubeSet, i, dot);
				}
			}
			return tubeSet;
		}
};

#endif
